package com.why.search.controller;

import com.why.search.Vo.SearchParam;
import com.why.search.Vo.SearchResult;
import com.why.search.service.MallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @program: why-gulimall
 * @description:
 * @author: @why
 * @create: 2021-06-04 08:40
 **/
@Controller
public class SearchController {


    @Autowired
    private MallService mallService;

    @GetMapping("list.html")
    public String getIndex(SearchParam param, Model model) {
        SearchResult result = mallService.search(param);
        model.addAttribute("result", result);
        return "list";
    }
}
